<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Mini Game Engine</title>
    <script src="https://unpkg.com/@tailwindcss/browser@4"></script>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css" rel="stylesheet">
    <style>
        body {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            background-color: #f0f0f0;
        }

        canvas {
            border: 1px solid #ccc;
        }
    </style>
</head>

<body>
    <canvas id="gameCanvas" width="800" height="600"></canvas>
    <script type="module">
        import GameEngine from './gameEngine.js';
        import GameEntity from './gameEntity.js';
        import PlayerEntity from './playerEntity.js';
        import { drawLine, drawCircle, loadImage } from './drawingUtils.js';

        const gameEngine = new GameEngine('gameCanvas');

        const player = new PlayerEntity(100, 100, 50, 50, 'blue');
        gameEngine.addEntity(player);

        const obstacle = new GameEntity(300, 300, 100, 100, 'red');
        gameEngine.addEntity(obstacle);

        gameEngine.start();

        // 示例：画线
        drawLine(gameEngine.ctx, 50, 50, 200, 200, 'green', 2);
        // 示例：画圆
        drawCircle(gameEngine.ctx, 400, 400, 30, 'purple');
        // 示例：加载图片
        loadImage('example.png', (img) => {
            gameEngine.ctx.drawImage(img, 600, 500);
        });
    </script>
</body>

</html>    